package com.neu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neu.po.Goodsmanage;
import com.neu.po.ResponseResult;
import com.neu.service.GoodsmanageService;

@RestController
@RequestMapping("goodsmanage")
public class GoodsmanageController {

	@Autowired
	private GoodsmanageService  goodsmanageService;
	@RequestMapping("getPaged")
	public ResponseResult getPaged(int pageNum,int pageSize,String keyword) {
		ResponseResult result = new ResponseResult();
		 result.setData(goodsmanageService.getPaged(pageNum, pageSize, keyword));
		 return result;
	}
	
	@RequestMapping("update")
	public ResponseResult update(@RequestBody Goodsmanage goodsmanage) {
		ResponseResult result = new ResponseResult();
		result.setData(goodsmanageService.update(goodsmanage));
		
		return result;
	}
	@RequestMapping("delete")
	public ResponseResult delete(int id) {
		ResponseResult result = new ResponseResult();
		result.setData(goodsmanageService.delete(id));
		
		return result;
	}
	@RequestMapping("insert")
	public ResponseResult insert(@RequestBody Goodsmanage goodsmanage) {
		ResponseResult result = new ResponseResult();
		//goodsmanage.setDelmark(1);
		result.setData(goodsmanageService.insert(goodsmanage));
		
		return result;
	}
	
	@RequestMapping("getAll")
	public ResponseResult getAll() {
		ResponseResult result = new ResponseResult();
		result.setData(goodsmanageService.getAll());
		
		return result;
	}
	@RequestMapping("batchDelete")
	public ResponseResult batchDelete(@RequestBody List<Integer> ids) {
		ResponseResult result = new ResponseResult();
		result.setData(goodsmanageService.batchDelete(ids));
		
		return result;
	}
}
